﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace RecruitmentProcessSystem
{
    class ConnectData
    {
        private SqlConnection con;
        public string getStringConnect()
        {
            String cn = "Data Source=Data Source=YAMOTO-PC;database=Quanlyhocsinh; user id=sa;password=090390";
            return cn;
        }
        public void connect()
        {
            String cn = getStringConnect();
            //String cn1 = "server=VKGAU-PC;Database = Quanlytruonghoc; Uid =sa ;Pwd= 123;";
            try
            {
                con = new SqlConnection(cn);
                con.Open();
                MessageBox.Show("Thanh Cong", "Thanh Cong", MessageBoxButtons.OK);
            }
            catch
            {
                MessageBox.Show("Khong ket noi duoc CSDL", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
        public void disconnect()
        {
            con.Close();
            con.Dispose();
            con = null;
        }
    }
}

